package com.xian.cloud.controller;

import com.xian.cloud.api.ServerFeginApi;
import com.xian.cloud.api.UserDubboApi;
import com.xian.cloud.entity.User;
import com.xian.cloud.entity.UserEntity;
import com.xian.cloud.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: xlr
 * @Date: Created in 10:37 PM 2019/8/23
 */
@Slf4j
@RestController
@RequestMapping("/client")
public class TestController {

    @Autowired
    private UserService userService;


    @GetMapping("/test")
    public User test() {
        return null;
    }

    @GetMapping("/find")
    public UserEntity find(@RequestParam("id") Long id){
        return userService.getById( id );
    }


    @GetMapping("/add")
    public String update(@RequestParam("name")String name) {
        UserEntity userEntity = new UserEntity();
        userEntity.setEmail("11111");
        userEntity.setPassWord("222222");
        userEntity.setUserName(name);

        return userService.saveTx(userEntity);
    }

}
